from append_trunk_to_PYTHONPATH import preparePath
preparePath()



###   This test fails, printing this in the console:

#E
#======================================================================
#ERROR: test_addToInventory (__main__.InventoryTests)
#----------------------------------------------------------------------
#Traceback (most recent call last):
#  File "/home/julka/workspace/trunk/tests/playerRelated_characterTest.py", line 15, in setUp
#    self.player = PlayerCharacter(DirectObject())
#  File "/home/julka/workspace/trunk/playerRelated/character.py", line 15, in __init__
#    self.inventory = Inventory(self.directObjectParent)
#  File "/home/julka/workspace/trunk/playerRelated/inventory.py", line 43, in __init__
#    self.inventoryGui = InventoryGui(self.directObjectParent)
#  File "/home/julka/workspace/trunk/gameGui/SklGui.py", line 41, in __init__
#    self.setUpInventory()
#  File "/home/julka/workspace/trunk/gameGui/SklGui.py", line 69, in setUpInventory
#    , itemFrame_pos = (0.35, 0, 0.4)
#  File "/usr/share/panda3d/direct/gui/DirectScrolledList.py", line 93, in __init__
#    DirectFrame.__init__(self, parent)
#  File "/usr/share/panda3d/direct/gui/DirectFrame.py", line 45, in __init__
#    DirectGuiWidget.__init__(self, parent)
#  File "/usr/share/panda3d/direct/gui/DirectGuiBase.py", line 733, in __init__
#    if __dev__:
#NameError: global name '__dev__' is not defined
#
#----------------------------------------------------------------------
#Ran 1 test in 0.004s
#
#FAILED (errors=1)

### I don't feel responsible for fixingt this. Maybe some other time... ^^"












import sys
# "/home/julka/workspace/trunk" is my directory in which whole eclipse projest is stored
#need to find a workaround...
sys.path.append("/home/julka/workspace/trunk") 

from playerRelated.character import PlayerCharacter
import unittest
from direct.showbase.DirectObject import DirectObject

class InventoryTests(unittest.TestCase):
    
    player = None
    
    def setUp(self):
        self.player = PlayerCharacter(DirectObject())
        
    def test_addToInventory(self):
####### first try adding single new item:
        str1 = 'peanut butter jelly'
        player.addToInventory(str1)
        self.failUnless(str1 in player._inventory._items)
        self.failUnless(player._inventory._items[str1] == 1)
        
        
def main():
    unittest.main()
    
if __name__ == '__main__':
    main()